import Validator from '@/utils/Validator'
import emitter from '@/utils/mitt'
import router from '@/router'
/**
 * 路由跳转 -> 只执行跳转，拦截还是由守卫完成
 * @param {*} params 
 * @returns 
 */
function navigateTo(params){
    let url = params?.url
    return new Promise(function(resolve,reject){
        if(Validator.isEmpty(url)){
            reject('path is empty')
        }
        router.push(url)
        resolve(url)
    })
}
function navigateBack(){
    return new Promise(function(resolve,reject){
        router.go(-1)
    })
}
export default {
    navigateTo,
    navigateBack
}